﻿using System;
using System.Linq;
using SuperSocket.SocketBase.Protocol;

namespace AccelerateSensor.SuperSocket.Server
{
    public class MyRequestInfo : IRequestInfo
    {
        public byte[] Header { get; set; }
        public byte[] Body { get; set; }

        public MyRequestInfo(byte[] header, byte[] body)
        {
            Header = header;
            Body = body;
        }

        public string Key => string.Empty;

        public string HexString
        {
            get
            {
                var buffer = new byte[Header.Length + Body.Length];
                Buffer.BlockCopy(Header, 0, buffer, 0, Header.Length);
                Buffer.BlockCopy(Body, 0, buffer, Header.Length, Body.Length);
                return string.Join("-", buffer.ToArray().Select(t => t.ToString("X")));
            }
        }
    }
}
